#include "SpriteTexture.h"

int SpriteTexture::LoadResource()
{
	if(this->ReadInfo())
		return 1;
	
	HRESULT result = D3DXCreateTextureFromFileEx(
		this->d3ddev,
		fileName,
		info.Width,
		info.Height,
		1,
		D3DPOOL_DEFAULT, // type of surface
		D3DFMT_UNKNOWN,
		D3DPOOL_DEFAULT, // memory?
		D3DX_DEFAULT,
		D3DX_DEFAULT,
		transColor,
		&info,
		NULL,
		&this->texture);
	if(result != D3D_OK)
		return 1;
	return 0;
}

SpriteTexture::SpriteTexture(LPWSTR filename, LPDIRECT3DDEVICE9 d3ddev, D3DCOLOR transcolor) : ISprite(filename, d3ddev, transcolor)
{
	texture = NULL;
}

SpriteTexture::SpriteTexture(void)
{
	texture = NULL;
}


SpriteTexture::~SpriteTexture(void)
{
	texture->Release();
}
